﻿using System;
using System.Data.Entity;
using System.Linq;
using MeetSomeNearbyStranger.DataModels;

namespace MeetSomeNearbyStrangerWebApi.Repositories
{
    public class DbUsersRepository : DbRepository<User>
    {
        public DbUsersRepository(DbContext context)
            : base(context)
        { }

        public User GetByNickname(string nickname)
        {
            return this.GetAll().FirstOrDefault<User>(u => u.Nickname == nickname);
        }

        public User GetByUserID(string userID)
        {
            return this.GetAll().FirstOrDefault<User>(u => u.UserID == userID);
        }

        public User GetById(int profileId)
        {
            return this.GetAll().FirstOrDefault<User>(u => u.Id == profileId);
        }
    }
}